﻿{% extends "super.html" %}
{% block title %}员工管理{% endblock %}
{% block s1 %}active{% endblock %}
{% block titlehref %}index{% endblock %}
{% block titlename %}全局动态{% endblock %}
{% block subtitlehref %}{% endblock %}
{% block subtitlename %}员工管理{% endblock %}
{% block content %}
<script type="text/javascript" src="static/myjs/staff.js"></script>
<section id="main-content">
    <section class="wrapper site-min-height">
        <div class="btn-row">
            <div class="btn-group" data-toggle="buttons">
                <button id="sh1" class="btn btn-primary">在职员工</button>
                <button id="sh2" class="btn btn-default">退休员工</button>
                <button id="sh3" class="btn btn-info">即将退休员工</button>

            </div>
        </div>

        <!-- BEGIN ROW  -->
        <div class="row" id="t1">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        <button class="btn btn-success" disabled>职工列表</button>
                        <span class="tools pull-right">
                        <button onclick="create()" class="btn btn-success" data-toggle="modal" data-target="#myModal">新建职工</button>
                           </span>
                    </header>
                    <div class="panel-body">
                        <div class="adv-table">
                            <table class="display table table-bordered table-striped" id="example">
                                <thead>
                                <tr>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>职称</th>
                                    <th>电话</th>
                                    <th>密码</th>
                                    <th>身份证</th>
                                    <th>薪资</th>
                                    <th>入职时间</th>
                                    <th>QQ</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {%for i in list%}
                                <tr>
                                    <td style="width: 8%">{{i.Username}}</td>
                                    <td style="width: 5%">
                                        {% if i.Sex == 1%}
                                        男
                                        {%else%}
                                        女
                                        {%endif%}
                                    </td>
                                    <td style="width: 8%">
                                        {% if i.Type == 1%}
                                        教师
                                        {%else%}
                                        劳务工
                                        {%endif%}
                                    </td>
                                    <td style="width: 10%">{{i.Phone}}</td>
                                    <td style="width: 10%">{{i.Password}}</td>
                                    <td style="width: 20%">{{i.Ident}}</td>
                                    <td style="width: 10%">{{i.Reap}} RMB</td>
                                    <td style="width: 15%">{{i.Create_time}}</td>
                                    <td style="width: 15%">{{i.Qq}}</td>
                                    <td>
                                        <button onclick="LoadStaff({{i.Id}})" class="btn-info" data-toggle="modal"
                                                data-target="#myModal">编辑
                                        </button>
                                        <button onclick="DeleteStaff({{i.Id}})" class="btn-danger">删除</button>
                                    </td>
                                </tr>
                                {%endfor%}
                                </tbody>
                                <tfoot>
                                <tr>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>职称</th>
                                    <th>电话</th>
                                    <th>密码</th>
                                    <th>身份证</th>
                                    <th>薪资</th>
                                    <th>入职时间</th>
                                    <th>QQ</th>
                                    <th>操作</th>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </section>
            </div>
        </div>
        <div class="row" hidden id="t2">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        <button class="btn btn-success" disabled>退休职工列表</button>
                    </header>
                    <div class="panel-body">
                        <div class="adv-table">
                            <table class="display table table-bordered table-striped" id="example2">
                                <thead>
                                <tr>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>职称</th>
                                    <th>电话</th>
                                    <th>密码</th>
                                    <th>身份证</th>
                                    <th>薪资</th>
                                    <th>入职时间</th>
                                    <th>QQ</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {%for i in list2%}
                                <tr>
                                    <td style="width: 8%">{{i.Username}}</td>
                                    <td style="width: 5%">
                                        {% if i.Sex == 1%}
                                        男
                                        {%else%}
                                        女
                                        {%endif%}
                                    </td>
                                    <td style="width: 8%">
                                        {% if i.Type == 1%}
                                        教师
                                        {%else%}
                                        劳务工
                                        {%endif%}
                                    </td>
                                    <td style="width: 10%">{{i.Phone}}</td>
                                    <td style="width: 10%">{{i.Password}}</td>
                                    <td style="width: 20%">{{i.Ident}}</td>
                                    <td style="width: 10%">{{i.Reap}} RMB</td>
                                    <td style="width: 15%">{{i.Create_time}}</td>
                                    <td style="width: 15%">{{i.Qq}}</td>
                                    <td>
                                        <button onclick="LoadStaff({{i.Id}})" class="btn-info" data-toggle="modal"
                                                data-target="#myModal">编辑
                                        </button>
                                        <button onclick="DeleteStaff({{i.Id}})" class="btn-danger">删除</button>
                                    </td>
                                </tr>
                                {%endfor%}
                                </tbody>
                                <tfoot>
                                <tr>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>职称</th>
                                    <th>电话</th>
                                    <th>密码</th>
                                    <th>身份证</th>
                                    <th>薪资</th>
                                    <th>入职时间</th>
                                    <th>QQ</th>
                                    <th>操作</th>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </section>
            </div>
        </div>
        <div class="row" hidden id="t3">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        <button class="btn btn-success" disabled>即将退休职工列表</button>
                    </header>
                    <div class="panel-body">
                        <div class="adv-table">
                            <table class="display table table-bordered table-striped" id="example3">
                                <thead>
                                <tr>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>职称</th>
                                    <th>电话</th>
                                    <th>密码</th>
                                    <th>身份证</th>
                                    <th>薪资</th>
                                    <th>入职时间</th>
                                    <th>QQ</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {%for i in list3%}
                                <tr>
                                    <td style="width: 8%">{{i.Username}}</td>
                                    <td style="width: 5%">
                                        {% if i.Sex == 1%}
                                        男
                                        {%else%}
                                        女
                                        {%endif%}
                                    </td>

                                    <td style="width: 8%">
                                        {% if i.Type == 1%}
                                        教师
                                        {%else%}
                                        劳务工
                                        {%endif%}
                                    </td>
                                    <td style="width: 10%">{{i.Phone}}</td>
                                    <td style="width: 10%">{{i.Password}}</td>
                                    <td style="width: 20%">{{i.Ident}}</td>
                                    <td style="width: 10%">{{i.Reap}} RMB</td>
                                    <td style="width: 15%">{{i.Create_time}}</td>
                                    <td style="width: 15%">{{i.Qq}}</td>
                                    <td>
                                        <button onclick="LoadStaff({{i.Id}})" class="btn-info" data-toggle="modal"
                                                data-target="#myModal">编辑
                                        </button>
                                        <button onclick="DeleteStaff({{i.Id}})" class="btn-danger">删除</button>
                                    </td>
                                </tr>
                                {%endfor%}
                                </tbody>
                                <tfoot>
                                <tr>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>职称</th>
                                    <th>电话</th>
                                    <th>密码</th>
                                    <th>身份证</th>
                                    <th>薪资</th>
                                    <th>入职时间</th>
                                    <th>QQ</th>
                                    <th>操作</th>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </section>
            </div>
        </div>


        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            编辑职工信息
                        </h4>
                    </div>
                    <div class="modal-body">
                        <form id="updatenews" action="staff" method="post">
                            <div class="panel-body">
                                <input id="id" name="id" hidden>
                                <input id="type" name="type" hidden>
                                <input id="sex" name="sex" hidden>
                                <input id="option" name="option" hidden>
                                <input id="own" name="own" value="1" hidden>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">姓名</label>
                                    <input type="text" class="form-control" id="username" name="username"
                                           placeholder="请输入姓名">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">密码</label>
                                    <input type="password" class="form-control" id="password" name="password"
                                           placeholder="请输入6~20位密码">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">身份证</label>
                                    <input type="number" class="form-control" id="ident" name="ident"
                                           placeholder="请输入18位身份证">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">电话</label>
                                    <input type="number" class="form-control" id="phone" name="phone"
                                           placeholder="请输入7~11位电话号码">
                                </div>
                                <div class="form-group">
                                    <p class="text-muted">
                                        性别
                                    </p>
                                    <div class="btn-group" data-toggle="buttons">
                                        <label class="btn btn-default active">
                                            <input class="sex" type="radio" id="option1" checked>
                                            男
                                        </label>
                                        <label class="btn btn-default">
                                            <input class="sex" type="radio" id="option2">
                                            女
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <p class="text-muted">
                                        类型
                                    </p>
                                    <div class="btn-group" data-toggle="buttons">
                                        <label class="btn btn-default active">
                                            <input class="type" type="radio" id="option3" checked>
                                            教师
                                        </label>
                                        <label class="btn btn-default">
                                            <input class="type" type="radio" id="option4">
                                            劳务工
                                        </label>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <p class="text-muted">
                                        所在部门：仅为教师时有效
                                    </p>
                                    <div class="btn-group">
                                        <button class="btn btn-white" type="button" id="desc">
                                            信息学院
                                        </button>
                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle"
                                                type="button"><span class="caret"></span></button>
                                        <ul role="menu" class="dropdown-menu">
                                            <li><a href="javascript:void(0);" onclick="choose(1,'信息学院')">信息学院</a>
                                            </li>
                                            <li><a href="javascript:void(0);"
                                                   onclick="choose(2,'机械自动化学院')">机械自动化学院</a></li>
                                            <li><a href="javascript:void(0);" onclick="choose(3,'电子学院')">电子学院</a>
                                            </li>
                                        </ul>
                                    </div>

                                </div>

                                <div class="form-group">
                                    <label for="exampleInputPassword1">薪资</label>
                                    <input type="number" class="form-control" id="reap" name="reap"
                                           placeholder="请输入职工薪资">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">QQ</label>
                                    <input type="number" class="form-control" id="qq" name="qq"
                                           placeholder="填写QQ有便于联系您">
                                </div>

                            </div>
                        </form>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                        <button id="update" type="button" class="btn btn-primary">
                            提交更改
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
        <!-- END ROW  -->
    </section>
</section>
<script>
	<!-- DATATABLE JS  -->
	$(document).ready(function () {
		$('#example').dataTable({
			"aaSorting": [[4, "desc"]]
		});
		$('#example2').dataTable({
			"aaSorting": [[4, "desc"]]
		});
		$('#example3').dataTable({
			"aaSorting": [[4, "desc"]]
		});
	});
</script>
{% endblock%}